package com.zwj.enums;

import com.zwj.vo.EnumResult;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public enum StudentPositionEnum {
    FRONT_END("1","前端开发"),TEST("2","测试"),BACK_END("3","后端开发"),PROJECT_MANAGER("4","项目经理"),PRODUCT_MANAGER("5","产品经理"),UI ("6","UI ");
    private String key;
    private String value;
    StudentPositionEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }
    public static String getEnumValue(String key) {
        StudentPositionEnum[] studentPositionEnums = StudentPositionEnum.values();
        for (StudentPositionEnum studentPositionEnum : studentPositionEnums) {
            if (studentPositionEnum.getKey().equals(key)) {
                return studentPositionEnum.getValue();
            }
        }
        return null;
    }
    public static List<EnumResult> getEnumList() {
        StudentPositionEnum[] studentPositionEnums = StudentPositionEnum.values();
        List<EnumResult> result = Stream.of(studentPositionEnums).map(
                entry -> new EnumResult(entry.getKey(), entry.getValue())).collect(Collectors.toList());
        return result;
    }
    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
